<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>导入excel方式一,导入成功跳转页面显示成功,利用submit提交，方式二位ajax提交,见方式二</title> 
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.11.0.min.js"></script>
   
</head> 
<body>  
    <form action="${pageContext.request.contextPath}/readExcel.jspx" enctype="multipart/form-data" method="post" id="batchAdd" name="batchAdd">  
		
		<tr class='normal'>  
           <td class='labely'>导入文件：</td>  
           <td class='context' colspan='3'>  
               <input type="file" id="excelFile" name="excelFile" class="text">  
                   <input type="submit" value="导入" onclick="addExcel();" class="btnstyle"/>  
           </td>  
       </tr> 
    </form>  
</body> 
<script type="text/javascript">  
	
	function addExcel(){
		var excelFile = $("#excelFile").val();
		alert(excelFile);
		 if($.trim(excelFile) == ""){  
	            alert("请先选择上传文件");  
	            return false;  
	        }  
	        //获取文件后缀名  
	        var value = excelFile.split(".")[excelFile.split(".").length -1];         
	        alert(value);
	          
	        if(value != "xls" && value != "xlsx"){  
	            alert("文件格式错误");  
	            return false;  
	        } 
	        
	        return true;
	        
	}
	        
 
       
</script>  
</html>